﻿@model Telecom.Data.TO_PHUONGXA

@{  AjaxOptions ajaxOpts = new AjaxOptions
    {
        HttpMethod = "post",
        OnComplete = "completedAjaxRequestwindow"
    };
}

<script type="text/javascript">

    function opBeginProcess_loading_window_submit() {
        $("#ContentwindowFunction").mask("Dữ liệu đang xử lý");
    }

    function completedAjaxRequestwindow(obj) {

        var returnObj = eval('(' + obj.responseText + ')');

        if (returnObj.Status == "success") {

            var $rowReload = $('#page_don_vi_TableContainer').jtable('getRowByKey', '@ViewBag.MaDonViAddPhuong');
            var $rorNex = $rowReload.next().find('.jtable-child-table-container').jtable('getRowByKey', '@Model.TOID');

            $rorNex.next().find('.jtable-child-table-container').jtable('reload')

            close_window_elements('window_addupdate_phuongxa_page');


        } else {

            $("#ContentwindowFunction").unmask();
            confirmOptionNormal(returnObj.Message);
        }

        return false;

    }

    $(document).ready(function () {

        $("#COM_QUANHUYEN_TOPX").combobox({

            url: _nameSubDomain + "/Donvi_ToQL/ListQuanHuyen_All",
            valueField: "MA_QUAN",
            textField: "TEN_QUAN",
            onSelect: function (row) {

                $("#COM_PHUONGXA_TOPX").combobox({ url: _nameSubDomain + "/Donvi_ToQL/ListPhuongXa_All?quanhuyenId=" + row.MA_QUAN });
                $("#PHUONGXAID").val("");

            }

        });

        $("#COM_PHUONGXA_TOPX").combobox({

            valueField: "MA_PHUONG",
            textField: "TEN_PHUONG",
            onSelect: function (row) {
                $("#PHUONGXAID").val(row.MA_PHUONG);
            },

        });

    });

     
</script>

@using (Ajax.BeginForm("AddTOKT_PHUONG", "Danhmuc", null, ajaxOpts, new { enctype = "multipart/form-data" }))
{
    <div id="ContentwindowFunction" class="ContentwindowFunction">
       <table class="tableContentWindowFunction">
           <tr>
                <td>
                   Tổ KT
                </td>
               <td>
                    @Html.HiddenFor(model => model.TOID)
                    @Html.HiddenFor(model => model.PHUONGXAID)
                   <span>@ViewBag.NameDonVToKT_Ad_PX</span>
               </td>
           </tr>
           <tr>
                <td>
                   Quận Huyện
                </td>
               <td>
                    <input class="easyui-combobox" value="" style="width:450px; height:27px" id="COM_QUANHUYEN_TOPX" name="COM_QUANHUYEN_TOPX">
               </td>
           </tr>
           <tr>
                <td>
                    Phường Xã
                </td>
               <td>
                   <input class="easyui-combobox" value="" style="width:450px; height:27px" id="COM_PHUONGXA_TOPX" name="COM_PHUONGXA_TOPX">
               </td>
           </tr>
           
       </table>
        <div style="height:0px"></div>
        <div class="footer_submit" style="margin-top: 10px; text-align: center">
            <button type="submit" onclick="return opBeginProcess_loading_window_submit(); ">
                <span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">Cập nhật tổ KT</span><span class="l-btn-icon icon-add">&nbsp;</span></span>    
            </button>
            <button type="button" onclick="return close_window_elements('window_addupdate_phuongxa_page');" >
                <span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">Hủy bỏ</span><span class="l-btn-icon icon-remove">&nbsp;</span></span></button>
        </div>
    </div>
    

}